import numpy as np

from .canonical_system import CanonicalSystem


class DiscreteCanonicalSystem(CanonicalSystem):
    def __init__(self, alpha=1.0) -> None:
        super().__init__(alpha)
        self._run_time = 1.0

    def step(self, tau: float) -> float:
        self._time += self._dt
        self._x = np.exp(- tau * self._alpha * self._time)
        return self._x

    def interpolate(self, t: float) -> float:
        tau = 1.0
        return np.exp(-tau * self._alpha * t)
